package com.lxc.consumergeneric;

import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.rpc.service.GenericService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lxc18
 * @date 2024/12/2 15:08
 * @description TestController
 */
@RestController
public class TestController {

    @Reference(generic = true,interfaceName = "com.lxc.common.HelloTestService")  // 泛化调用
    private GenericService genericService;  // 引用GenericService接口
    @RequestMapping("/hello")
    public String Hello() {

        // 调用泛化接口
        Object result = genericService.$invoke("sayTestHello", new String[]{"java.lang.String"}, new Object[]{"consumer-generic"});
        return (String) result;  // 返回调用结果

    }

}
